package com.hxh.sync;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/9/9 20:25
 * 可重入锁
 */
public class SyncLockDemo {

    private static final Object object = new Object();

    public static void main(String[] args) {
        new Thread(() -> {
            synchronized (object) {
                System.out.println("外层");
                synchronized (object) {
                    System.out.println("中层");
                    synchronized (object) {
                        System.out.println("内层");
                    }
                }
            }
        }).start();
    }
}
